package com.cqupt.utils;

import com.cqupt.command.Command;
import com.cqupt.command.imp.CatCommand;
import com.cqupt.command.imp.GrepCommand;
import com.cqupt.command.imp.CutCommand;
import com.cqupt.command.imp.SortCommand;
import com.cqupt.command.imp.WcCommand;

public class CommandFactor {

	public static Command getCommand(String commandString, String result) {
		//拿到命令的名字
		String CommandName = commandString.trim().split(" ")[0];
		switch (CommandName) {
		case "sort":
			return new SortCommand(commandString, result);
		case "cat":
			return new CatCommand(commandString, result);	
		case "grep":
			return new GrepCommand(commandString, result);
		case "wc":
			return new WcCommand(commandString, result);
		case "cut":
			return new CutCommand(commandString, result);
		default:
			return null;
		}
	}

}
